| related |
|
|---|
Commands
lsusb
lspci
lsha
dmidecode
dmidecode -s system-product-name
hdparm -I /dev/....
smartctl -a /dev/...
Get available and selected disk I/O scheduler
cat /sys/block/sda/queue/scheduler
Set Linux disk IO scheduler
echo deadline > /sys/block/sda/queue/scheduler
How to enable BFQ scheduler with udev
Check and change scheduler settings with schedtool
schedtool <pid> # Print settings for given PID
schedtool -r # Show scheduler class prio ranges
schedtool -R -p 20 -e <command> # Run command with SCHED_RR and nice 20
List per-process scheduler settings
ps -wweALo pid,spid,user,priority,ni,pcpu,vsize,time,args
Check CPU freq governor
cat /sys/devices/system/cpu/cpufreq/policy*/scaling_governor
Check SCHED_ISO settings
cat /proc/sys/kernel/iso_cpu
Check if CFS is default scheduler
grep cfs_rq /proc/sched_debug
Check if there are processes not running with CFS (SCHED_OTHER)
ps -ef|grep [0-9]|awk '\{system("chrt -p " $2);print $0}' | grep -Ev 'priority|SCHED_OTHER' |grep -A1 SCHED
Human readable sar output
sar -n DEV 1 1 # e.g. show recent Device I/O
# Save one complete sample if you have no collection enabled
sar -o /tmp/sar.out -n ALL 1 1
Machine readable: you need to use sadf
sadf -j /tmp/sar.out -- -n DEV # All in nice JSON
-
Create swap file and mount it
dd if=/dev/zero of=/swapfile bs=1024000 count=1024 # Create ~1GB file mkswap /swapfile chmod 0600 /swapfile swapon /swapfileTo persist mounting the swapfile add an entry in /etc/fstab like this
/swapfile none swap sw 0 0
-
Find broken links
find . -xtype l -
pv - Visualize pipe progress:
pv -cN source < linux-3.4.0.tar.bz2 | bzcat | pv -cN bzcat | gzip -9 | pv -cN gzip > linux-3.4.0.tar.gz -
Fix broken text encoding:
iconv -c -t ASCII input.txt iconv -c -t latin1 input.txt -
rsyslog - Modify rate imux limiting
$SystemLogRateLimitInterval 2 $SystemLogRateLimitBurst 50 # increase this -
Running parallel SSH sessions using xargs
echo "$hosts" | xargs --replace={} -t -n 1 -P 15 sh -c "ssh -o StrictHostKeyChecking=no -o PreferredAuthentications=publickey {} date || :" -
Force line buffering (aka autoflush) for a process that does buffer logs
exec stdbuf -oL -eL <command>